package com.hd.trans.network.bean.wavToLip

import android.util.ArrayMap
import com.hd.trans.network.ParamUtils
import com.hd.trans.network.bean.UserInfoBean
import okhttp3.RequestBody

/**
 * AI陪练：创建“音频对口型输出视频”任务接口请求数据
 */
data class Wav2LipRequest(
    val audio_url: String? = null,//音频文件链接
    val file_url: String? = null,//视频文件链接,或者图像文件链接
    val anchor: String? = null,//主播名称，如：1080-woman-5
    val opensr: Int = 0//1 或 0 是否开启超分，输出最好画质
){
    fun makeRequestBody(userinfoBean: UserInfoBean?): RequestBody {
        val params = ParamUtils.createText2VoiceParams(ArrayMap<String, Any>().apply {
            audio_url?.let {
                put("audio_url", it)
            }
            anchor?.let {
                put("anchor", it)
            }
            file_url?.let {
                remove("anchor")
                put("file_url", it)
            }
            if(opensr == 0 || opensr == 1){
                put("opensr", opensr)
            }
        }, userinfoBean)
        return params
    }
}
